package com.laboratory.report.lab03;

import javax.swing.*;
import java.awt.*;

/**
 * 测试
 */
public class Lab03Main extends JFrame {

    private OlympicTable olympicTable = new OlympicTable();

    public Lab03Main() throws HeadlessException {
        // 初始化数据库
        DbFactory.init();

        setTitle("奥运奖牌榜");
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        // 让窗口在屏幕中间显示
        setLocationRelativeTo(null);
        setSize(500, 400);

        setLayout(new GridLayout(2, 1));

        add(olympicTable);
        olympicTable.showData(DbFactory.loadAllData());

        add(new ButtonPannel(olympicTable));

//        pack();
    }

    public static void main(String[] args) {
        new Lab03Main().setVisible(true);
    }
}
